home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hot Super Models
/
Hot Super Models.iso
/
unix
/
x11
/
xv200.tar
/
xv-2.00
/
unsupt
/
VMS
/
XV.DIFF
< prev
Wrap
Text File
|
1992-01-01
|
81KB
|
3,078 lines
*** disk$vis:[xv.orig]bggen.c
--- bggen.c
**************
*** 29,34
#define DEFSIZE 1024
#define MAXCOLS 128
struct color { int r,g,b; int y; } cols[MAXCOLS], *cur, *nex;
int bmask[8] = { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
--- 29,37 -----
#define DEFSIZE 1024
#define MAXCOLS 128
+ #ifdef VMS
+ struct color { int r,g,b; int y; } colors[MAXCOLS], *cur, *nex;
+ #else
struct color { int r,g,b; int y; } cols[MAXCOLS], *cur, *nex;
#endif
**************
*** 30,35
#define MAXCOLS 128
struct color { int r,g,b; int y; } cols[MAXCOLS], *cur, *nex;
int bmask[8] = { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
--- 33,39 -----
struct color { int r,g,b; int y; } colors[MAXCOLS], *cur, *nex;
#else
struct color { int r,g,b; int y; } cols[MAXCOLS], *cur, *nex;
+ #endif
int bmask[8] = { 0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff };
**************
*** 44,49
int bits = 8;
int r, g, b;
cnt = 0; numcols = 0;
for (i=1; i<argc; i++) {
if (!strcmp(argv[i],"-s")) high = atoi(argv[++i]);
--- 48,56 -----
int bits = 8;
int r, g, b;
+ #ifdef VMS
+ getredirection (&argc, &argv);
+ #endif
cnt = 0; numcols = 0;
for (i=1; i<argc; i++) {
if (!strcmp(argv[i],"-s")) high = atoi(argv[++i]);
**************
*** 56,61
else {
switch (cnt) {
case 0: cols[numcols].r = atoi(argv[i]); break;
case 1: cols[numcols].g = atoi(argv[i]); break;
case 2: cols[numcols].b = atoi(argv[i]); break;
--- 63,73 -----
else {
switch (cnt) {
+ #ifdef VMS
+ case 0: colors[numcols].r = atoi(argv[i]); break;
+ case 1: colors[numcols].g = atoi(argv[i]); break;
+ case 2: colors[numcols].b = atoi(argv[i]); break;
+ #else
case 0: cols[numcols].r = atoi(argv[i]); break;
case 1: cols[numcols].g = atoi(argv[i]); break;
case 2: cols[numcols].b = atoi(argv[i]); break;
**************
*** 59,64
case 0: cols[numcols].r = atoi(argv[i]); break;
case 1: cols[numcols].g = atoi(argv[i]); break;
case 2: cols[numcols].b = atoi(argv[i]); break;
}
cnt++;
--- 71,77 -----
case 0: cols[numcols].r = atoi(argv[i]); break;
case 1: cols[numcols].g = atoi(argv[i]); break;
case 2: cols[numcols].b = atoi(argv[i]); break;
+ #endif
}
cnt++;
**************
*** 89,94
if (numcols==1) {
for (i=0; i<high; i++)
for (j=0; j<wide; j++)
printf("%d %d %d\n",cols[0].r,cols[0].g,cols[0].b);
}
else {
--- 102,110 -----
if (numcols==1) {
for (i=0; i<high; i++)
for (j=0; j<wide; j++)
+ #ifdef VMS
+ printf("%d %d %d\n",colors[0].r,colors[0].g,colors[0].b);
+ #else
printf("%d %d %d\n",cols[0].r,cols[0].g,cols[0].b);
#endif
}
**************
*** 90,95
for (i=0; i<high; i++)
for (j=0; j<wide; j++)
printf("%d %d %d\n",cols[0].r,cols[0].g,cols[0].b);
}
else {
--- 106,112 -----
printf("%d %d %d\n",colors[0].r,colors[0].g,colors[0].b);
#else
printf("%d %d %d\n",cols[0].r,cols[0].g,cols[0].b);
+ #endif
}
else {
**************
*** 95,100
/* fill in 'y' field of cols[] */
for (i=0; i<numcols; i++)
cols[i].y = ((high-1) * i) / (numcols-1);
cur = &cols[0]; nex = cur+1;
--- 112,120 -----
/* fill in 'y' field of cols[] */
for (i=0; i<numcols; i++)
+ #ifdef VMS
+ colors[i].y = ((high-1) * i) / (numcols-1);
+ #else
cols[i].y = ((high-1) * i) / (numcols-1);
#endif
**************
*** 96,101
/* fill in 'y' field of cols[] */
for (i=0; i<numcols; i++)
cols[i].y = ((high-1) * i) / (numcols-1);
cur = &cols[0]; nex = cur+1;
--- 116,122 -----
colors[i].y = ((high-1) * i) / (numcols-1);
#else
cols[i].y = ((high-1) * i) / (numcols-1);
+ #endif
#ifdef VMS
cur = &colors[0]; nex = cur+1;
**************
*** 97,102
for (i=0; i<numcols; i++)
cols[i].y = ((high-1) * i) / (numcols-1);
cur = &cols[0]; nex = cur+1;
for (i=0; i<high; i++) {
--- 118,126 -----
cols[i].y = ((high-1) * i) / (numcols-1);
#endif
+ #ifdef VMS
+ cur = &colors[0]; nex = cur+1;
+ #else
cur = &cols[0]; nex = cur+1;
#endif
**************
*** 98,103
cols[i].y = ((high-1) * i) / (numcols-1);
cur = &cols[0]; nex = cur+1;
for (i=0; i<high; i++) {
/* advance to next pair of colors if we're outside region */
--- 122,128 -----
cur = &colors[0]; nex = cur+1;
#else
cur = &cols[0]; nex = cur+1;
+ #endif
for (i=0; i<high; i++) {
/* advance to next pair of colors if we're outside region */
*** disk$vis:[xv.orig]imakefile.
--- imakefile.
**************
*** 75,81
#if defined(SCOArchitecture)
! DEFINES= -DPOSIX -DNOITIMER
SYS_LIBRARIES= $(XLIB) -lm -lc -lx
#else
SYS_LIBRARIES= $(XLIB) -lm
--- 75,81 -----
#if defined(SCOArchitecture)
! SCO_DEFINES= -DPOSIX -DNOITIMER
SYS_LIBRARIES= $(XLIB) -lm -lc -lx
#else
SYS_LIBRARIES= $(XLIB) -lm
**************
*** 81,88
SYS_LIBRARIES= $(XLIB) -lm
#endif
! DEFINES= $(DEFINES) $(UNIX) $(NEED_DIRENT) $(BROKECOLS) \
! $(VPRINTF) $(TIMERS) $(ATT) $(USEMEM)
SYS_LIBRARIES= -lX11 -lm
--- 81,87 -----
SYS_LIBRARIES= $(XLIB) -lm
#endif
! JPEGDIR = $(HOME)/jpeg
INCLUDES= -I$(JPEGDIR)
**************
*** 84,89
DEFINES= $(DEFINES) $(UNIX) $(NEED_DIRENT) $(BROKECOLS) \
$(VPRINTF) $(TIMERS) $(ATT) $(USEMEM)
SYS_LIBRARIES= -lX11 -lm
BITMAPS = bitmaps/grasp bitmaps/penn bitmaps/down bitmaps/down1 \
--- 83,93 -----
JPEGDIR = $(HOME)/jpeg
+ INCLUDES= -I$(JPEGDIR)
+
+ DEFINES= $(SCO_DEFINES) $(UNIX) $(NEED_DIRENT) $(BROKECOLS) \
+ $(VPRINTF) $(TIMERS) $(ATT) $(USEMEM)
+
SYS_LIBRARIES= -lX11 -lm
BITMAPS = bitmaps/grasp bitmaps/penn bitmaps/down bitmaps/down1 \
**************
*** 96,101
bitmaps/fc_left1m bitmaps/fc_right1 bitmaps/fc_right1m \
bitmaps/icon
SRCS1 = xv.c xv24to8.c xvbutt.c xvctrl.c xvdir.c xvfish.c xvgam.c\
xvgif.c xvgifwr.c xvinfo.c xvmisc.c xvpbm.c xvpm.c xvscrl.c\
xvxbm.c vprintf.c
--- 100,111 -----
bitmaps/fc_left1m bitmaps/fc_right1 bitmaps/fc_right1m \
bitmaps/icon
+ JOBJS = $(JPEGDIR)/jerror.o $(JPEGDIR)/jrdjfif.o $(JPEGDIR)/jdcolor.o \
+ $(JPEGDIR)/jdhuff.o $(JPEGDIR)/jdmaster.o $(JPEGDIR)/jdmcu.o \
+ $(JPEGDIR)/jdpipe.o $(JPEGDIR)/jdsample.o $(JPEGDIR)/jrevdct.o \
+ $(JPEGDIR)/jutils.o $(JPEGDIR)/jvirtmem.o $(JPEGDIR)/jbsmooth.o \
+ $(JPEGDIR)/jquant1.o $(JPEGDIR)/jquant2.o
+
SRCS1 = xv.c xv24to8.c xvbutt.c xvctrl.c xvdir.c xvfish.c xvgam.c\
xvgif.c xvgifwr.c xvinfo.c xvmisc.c xvpbm.c xvpm.c xvscrl.c\
xvxbm.c vprintf.c xvjpeg.c
**************
*** 98,104
SRCS1 = xv.c xv24to8.c xvbutt.c xvctrl.c xvdir.c xvfish.c xvgam.c\
xvgif.c xvgifwr.c xvinfo.c xvmisc.c xvpbm.c xvpm.c xvscrl.c\
! xvxbm.c vprintf.c
OBJS1 = xv.o xv24to8.o xvbutt.o xvctrl.o xvdir.o xvfish.o xvgam.o\
xvgif.o xvgifwr.o xvinfo.o xvmisc.o xvpbm.o xvpm.o xvscrl.o \
--- 108,114 -----
SRCS1 = xv.c xv24to8.c xvbutt.c xvctrl.c xvdir.c xvfish.c xvgam.c\
xvgif.c xvgifwr.c xvinfo.c xvmisc.c xvpbm.c xvpm.c xvscrl.c\
! xvxbm.c vprintf.c xvjpeg.c
OBJS1 = xv.o xv24to8.o xvbutt.o xvctrl.o xvdir.o xvfish.o xvgam.o\
xvgif.o xvgifwr.o xvinfo.o xvmisc.o xvpbm.o xvpm.o xvscrl.o \
**************
*** 102,108
OBJS1 = xv.o xv24to8.o xvbutt.o xvctrl.o xvdir.o xvfish.o xvgam.o\
xvgif.o xvgifwr.o xvinfo.o xvmisc.o xvpbm.o xvpm.o xvscrl.o \
! xvxbm.o vprintf.o
SRCS2= bggen.c
OBJS2= bggen.o
--- 112,118 -----
OBJS1 = xv.o xv24to8.o xvbutt.o xvctrl.o xvdir.o xvfish.o xvgam.o\
xvgif.o xvgifwr.o xvinfo.o xvmisc.o xvpbm.o xvpm.o xvscrl.o \
! xvxbm.o vprintf.o xvjpeg.o $(JOBJS)
SRCS2= bggen.c
OBJS2= bggen.o
**************
*** 109,114
PROGRAMS= xv bggen
ComplexProgramTarget_1(xv,,)
ComplexProgramTarget_2(bggen,,)
--- 119,128 -----
PROGRAMS= xv bggen
+ #define IHaveSubdirs
+ #define PassCDebugFlags
+ SUBDIRS= $(JPEGDIR)
+ MakeSubdirs($(SUBDIRS))
ComplexProgramTarget_1(xv,,)
ComplexProgramTarget_2(bggen,,)
*** disk$vis:[xv.orig]xv.c
--- xv.c
**************
*** 53,58
#define PM 2
#define PBM 3
#define XBM 4
static unsigned long rootbg, rootfg; /* fg/bg for root border */
static int waitsec = -1; /* seconds between pics. -1=wait for event */
--- 53,59 -----
#define PM 2
#define PBM 3
#define XBM 4
+ #define JFIF 5
static unsigned long rootbg, rootfg; /* fg/bg for root border */
static int waitsec = -1; /* seconds between pics. -1=wait for event */
**************
*** 97,102
static int rd_int();
static int rd_str();
static int rd_flag();
--- 98,105 -----
static int rd_int();
static int rd_str();
static int rd_flag();
+ static int XvErrorHandler();
+ static int rd_boolean();
**************
*** 121,127
/*** variable Initialization ***/
/*****************************************************/
! #ifdef SYSV
getcwd(initpath, sizeof(initpath));
#else
getwd(initpath);
--- 124,130 -----
/*** variable Initialization ***/
/*****************************************************/
! #if (defined(SYSV) || defined(SVR4) || defined(VMS))
getcwd(initpath, sizeof(initpath));
#else
getwd(initpath);
**************
*** 134,139
theImage = NULL;
LocalCmap = 0;
InitFSDTables();
cmd = rindex(argv[0],'/');
if (!cmd) cmd = argv[0]; else cmd++;
--- 137,146 -----
theImage = NULL;
LocalCmap = 0;
InitFSDTables();
+ #ifdef VMS
+ getredirection (&argc, &argv);
+ cmd = rindex(argv[0],']');
+ #else
cmd = rindex(argv[0],'/');
#endif
if (!cmd) cmd = argv[0]; else cmd++;
**************
*** 135,140
LocalCmap = 0;
InitFSDTables();
cmd = rindex(argv[0],'/');
if (!cmd) cmd = argv[0]; else cmd++;
--- 142,148 -----
cmd = rindex(argv[0],']');
#else
cmd = rindex(argv[0],'/');
+ #endif
if (!cmd) cmd = argv[0]; else cmd++;
**************
*** 158,169
useroot = clrroot = noqcheck = rwcolor = fishrunning = 0;
fish = 0;
- #ifdef BROKEFREECOLS
- brokeFreeCols = 1;
- #else
- brokeFreeCols = 0;
- #endif
-
defaspect = normaspect = 1.0;
mainW = dirW = infoW = ctrlW = gamW = NULL;
--- 166,171 -----
useroot = clrroot = noqcheck = rwcolor = fishrunning = 0;
fish = 0;
defaspect = normaspect = 1.0;
mainW = dirW = infoW = ctrlW = gamW = NULL;
**************
*** 210,216
if (rd_str ("background")) bgstr = def_str;
if (rd_str ("black")) blackstr = def_str;
if (rd_int ("borderWidth")) bwidth = def_int;
- if (rd_flag("brokeFreeCols")) brokeFreeCols = def_int;
if (rd_flag("centerPic")) centerpic = def_int;
if (rd_str ("ctrlGeometry")) ctrlgeom = def_str;
if (rd_flag("ctrlMap")) ctrlmap = def_int;
--- 212,217 -----
if (rd_str ("background")) bgstr = def_str;
if (rd_str ("black")) blackstr = def_str;
if (rd_int ("borderWidth")) bwidth = def_int;
if (rd_flag("centerPic")) centerpic = def_int;
if (rd_str ("ctrlGeometry")) ctrlgeom = def_str;
if (rd_flag("ctrlMap")) ctrlmap = def_int;
**************
*** 294,302
else if (!strncmp(argv[i],"-au",3)) /* autogamma */
autogamma++;
- else if (!strncmp(argv[i],"-bf",3)) /* brokeFreeCols */
- brokeFreeCols = !brokeFreeCols;
-
else if (!strncmp(argv[i],"-bg",3)) /* background color */
{ if (++i<argc) bgstr = argv[i]; }
--- 295,300 -----
else if (!strncmp(argv[i],"-au",3)) /* autogamma */
autogamma++;
else if (!strncmp(argv[i],"-bg",3)) /* background color */
{ if (++i<argc) bgstr = argv[i]; }
**************
*** 711,716
/* set up fullname and basename */
fullname = namelist[filenum];
tmp = rindex(fullname,'/');
if (!tmp) tmp = fullname; else tmp++;
strcpy(basename,tmp);
--- 709,717 -----
/* set up fullname and basename */
fullname = namelist[filenum];
+ #ifdef VMS
+ tmp = rindex(fullname,']');
+ #else
tmp = rindex(fullname,'/');
#endif
if (!tmp) tmp = fullname; else tmp++;
**************
*** 712,717
fullname = namelist[filenum];
tmp = rindex(fullname,'/');
if (!tmp) tmp = fullname; else tmp++;
strcpy(basename,tmp);
if (strlen(basename)>2 && strcmp(basename+strlen(basename)-2,".Z")==0)
--- 713,719 -----
tmp = rindex(fullname,']');
#else
tmp = rindex(fullname,'/');
+ #endif
if (!tmp) tmp = fullname; else tmp++;
strcpy(basename,tmp);
if (strlen(basename)>2 && strcmp(basename+strlen(basename)-2,".Z")==0)
**************
*** 722,727
freename = 0;
if (fullname[0] != '/' && strcmp(fullname,STDINSTR)!=0) {
char *tmp;
tmp = (char *) malloc(strlen(fullname) + strlen(initpath) + 2);
if (!tmp) FatalError("malloc 'filename' failed");
sprintf(tmp,"%s/%s", initpath, fullname);
--- 724,732 -----
freename = 0;
if (fullname[0] != '/' && strcmp(fullname,STDINSTR)!=0) {
char *tmp;
+ #ifdef VMS
+ tmp = (char *) malloc(strlen(fullname) + 2);
+ #else
tmp = (char *) malloc(strlen(fullname) + strlen(initpath) + 2);
#endif
if (!tmp) FatalError("malloc 'filename' failed");
**************
*** 723,728
if (fullname[0] != '/' && strcmp(fullname,STDINSTR)!=0) {
char *tmp;
tmp = (char *) malloc(strlen(fullname) + strlen(initpath) + 2);
if (!tmp) FatalError("malloc 'filename' failed");
sprintf(tmp,"%s/%s", initpath, fullname);
fullname = tmp;
--- 728,734 -----
tmp = (char *) malloc(strlen(fullname) + 2);
#else
tmp = (char *) malloc(strlen(fullname) + strlen(initpath) + 2);
+ #endif
if (!tmp) FatalError("malloc 'filename' failed");
#ifdef VMS
sprintf(tmp,"%s", fullname);
**************
*** 724,729
char *tmp;
tmp = (char *) malloc(strlen(fullname) + strlen(initpath) + 2);
if (!tmp) FatalError("malloc 'filename' failed");
sprintf(tmp,"%s/%s", initpath, fullname);
fullname = tmp;
freename = 1;
--- 730,738 -----
tmp = (char *) malloc(strlen(fullname) + strlen(initpath) + 2);
#endif
if (!tmp) FatalError("malloc 'filename' failed");
+ #ifdef VMS
+ sprintf(tmp,"%s", fullname);
+ #else
sprintf(tmp,"%s/%s", initpath, fullname);
#endif
fullname = tmp;
**************
*** 725,730
tmp = (char *) malloc(strlen(fullname) + strlen(initpath) + 2);
if (!tmp) FatalError("malloc 'filename' failed");
sprintf(tmp,"%s/%s", initpath, fullname);
fullname = tmp;
freename = 1;
}
--- 734,740 -----
sprintf(tmp,"%s", fullname);
#else
sprintf(tmp,"%s/%s", initpath, fullname);
+ #endif
fullname = tmp;
freename = 1;
}
**************
*** 752,757
if (strcmp(filename,STDINSTR)==0) {
FILE *fp;
strcpy(filename,"/tmp/xvXXXXXX");
mktemp(filename);
--- 762,770 -----
if (strcmp(filename,STDINSTR)==0) {
FILE *fp;
+ #ifdef VMS
+ strcpy(filename,"Sys$Disk:[]xvXXXXXX");
+ #else
strcpy(filename,"/tmp/xvXXXXXX");
#endif
mktemp(filename);
**************
*** 753,758
FILE *fp;
strcpy(filename,"/tmp/xvXXXXXX");
mktemp(filename);
fp = fopen(filename,"w");
--- 766,772 -----
strcpy(filename,"Sys$Disk:[]xvXXXXXX");
#else
strcpy(filename,"/tmp/xvXXXXXX");
+ #endif
mktemp(filename);
fp = fopen(filename,"w");
**************
*** 756,761
mktemp(filename);
fp = fopen(filename,"w");
if (!fp) FatalError("can't write /tmp/xv****** file");
while ( (i=getchar()) != EOF) putc(i,fp);
--- 770,778 -----
mktemp(filename);
fp = fopen(filename,"w");
+ #ifdef VMS
+ if (!fp) FatalError("can't write Sys$Disk:[]xv****** file");
+ #else
if (!fp) FatalError("can't write /tmp/xv****** file");
#endif
**************
*** 757,762
fp = fopen(filename,"w");
if (!fp) FatalError("can't write /tmp/xv****** file");
while ( (i=getchar()) != EOF) putc(i,fp);
fclose(fp);
--- 774,780 -----
if (!fp) FatalError("can't write Sys$Disk:[]xv****** file");
#else
if (!fp) FatalError("can't write /tmp/xv****** file");
+ #endif
while ( (i=getchar()) != EOF) putc(i,fp);
fclose(fp);
**************
*** 768,773
fp=fopen(filename,"r");
if (!fp) {
SetISTR(ISTR_INFO,"Can't open '%s' - %s",filename,sys_errlist[errno]);
Warning();
goto FAILED;
--- 786,794 -----
fp=fopen(filename,"r");
if (!fp) {
+ #ifdef VMS
+ SetISTR(ISTR_INFO,"Can't open '%s'",filename);
+ #else
SetISTR(ISTR_INFO,"Can't open '%s' - %s",filename,sys_errlist[errno]);
#endif
Warning();
**************
*** 769,774
fp=fopen(filename,"r");
if (!fp) {
SetISTR(ISTR_INFO,"Can't open '%s' - %s",filename,sys_errlist[errno]);
Warning();
goto FAILED;
}
--- 790,796 -----
SetISTR(ISTR_INFO,"Can't open '%s'",filename);
#else
SetISTR(ISTR_INFO,"Can't open '%s' - %s",filename,sys_errlist[errno]);
+ #endif
Warning();
goto FAILED;
}
**************
*** 777,783
fclose(fp);
filetype = UNKNOWN;
! if (strncmp(magicno,"GIF87",5)==0) filetype = GIF;
else if (strncmp(magicno,"VIEW",4)==0 ||
strncmp(magicno,"WEIV",4)==0) filetype = PM;
--- 799,805 -----
fclose(fp);
filetype = UNKNOWN;
! if (strncmp(magicno,"GIF",3)==0) filetype = GIF;
else if (magicno[0] == -1 &&
magicno[1] == -40 &&
**************
*** 779,784
filetype = UNKNOWN;
if (strncmp(magicno,"GIF87",5)==0) filetype = GIF;
else if (strncmp(magicno,"VIEW",4)==0 ||
strncmp(magicno,"WEIV",4)==0) filetype = PM;
--- 801,810 -----
filetype = UNKNOWN;
if (strncmp(magicno,"GIF",3)==0) filetype = GIF;
+ else if (magicno[0] == -1 &&
+ magicno[1] == -40 &&
+ magicno[2] == -1) filetype = JFIF;
+
else if (strncmp(magicno,"VIEW",4)==0 ||
strncmp(magicno,"WEIV",4)==0) filetype = PM;
**************
*** 796,805
SetISTR(ISTR_INFO,"Loading '%s'...",basename);
switch (filetype) {
! case GIF: i = LoadGIF(filename,ncols); break;
! case PM: i = LoadPM (filename,ncols); break;
! case PBM: i = LoadPBM(filename,ncols); break;
! case XBM: i = LoadXBM(filename,ncols); break;
}
WaitCursor();
--- 822,834 -----
SetISTR(ISTR_INFO,"Loading '%s'...",basename);
switch (filetype) {
! case GIF: i = LoadGIF (filename,ncols); break;
! case PM: i = LoadPM (filename,ncols); break;
! case PBM: i = LoadPBM (filename,ncols); break;
! case XBM: i = LoadXBM (filename,ncols); break;
! /* not avaiable yet
! case JFIF: i = LoadJFIF(filename,ncols); break;
! */
}
WaitCursor();
**************
*** 960,969
XFreeColormap(theDisp,LocalCmap);
LocalCmap = 0;
}
- else if (!brokeFreeCols) {
- for (i=0; i<nfcols; i++)
- XFreeColors(theDisp, theCmap, &freecols[i], 1, 0L);
- }
else {
for (i=0; i<nfcols; i++) {
int j;
--- 989,994 -----
XFreeColormap(theDisp,LocalCmap);
LocalCmap = 0;
}
else {
XvFreeColors(theDisp, theCmap, freecols, 1, 0L, nfcols);
}
**************
*** 965,979
XFreeColors(theDisp, theCmap, &freecols[i], 1, 0L);
}
else {
! for (i=0; i<nfcols; i++) {
! int j;
! for (j=0; j<i; j++) {
! if (freecols[i] == freecols[j]) /* already been freed once */
! break;
! }
! if (j==i) /* wasn't found in already-freed list */
! XFreeColors(theDisp, theCmap, &freecols[i], 1, 0L);
! }
}
if (epic != cpic && epic != NULL) free(epic);
--- 990,996 -----
LocalCmap = 0;
}
else {
! XvFreeColors(theDisp, theCmap, freecols, 1, 0L, nfcols);
}
if (epic != cpic && epic != NULL) free(epic);
**************
*** 1791,1796
* twm where resize was giving 23 extra lines...
* should do no harm if this bug is not present.
*/
XSync(theDisp,False);
XGetWindowAttributes(theDisp, mainW, &pxwa);
if (pxwa.height != xwa->height) {
--- 1808,1814 -----
* twm where resize was giving 23 extra lines...
* should do no harm if this bug is not present.
*/
+ #ifdef TWMKLUDGE
XSync(theDisp,False);
XGetWindowAttributes(theDisp, mainW, &pxwa);
if (pxwa.height != xwa->height) {
**************
*** 1803,1808
XResizeWindow(theDisp, mainW, xwa->width,
xwa->height - (pxwa.height - xwa->height));
}
}
--- 1821,1827 -----
XResizeWindow(theDisp, mainW, xwa->width,
xwa->height - (pxwa.height - xwa->height));
}
+ #endif /* TWMKLUDGE */
}
**************
*** 2039,2044
/* returns true if there's a config event in which mainW changes size
in the event queue */
foo = 0;
XCheckIfEvent(theDisp, &ev, IsConfig, &foo);
return foo;
--- 2058,2064 -----
/* returns true if there's a config event in which mainW changes size
in the event queue */
+ XSync(theDisp, False);
foo = 0;
XCheckIfEvent(theDisp, &ev, IsConfig, &foo);
return foo;
**************
*** 2224,2233
/* returns '1' if successful. result in def_str */
if (def_str = XGetDefault(theDisp, PROGNAME, name)) {
! def_int = (strcmp(def_str, "on")==0) ||
! (strcmp(def_str, "1")==0) ||
! (strcmp(def_str, "true")==0) ||
! (strcmp(def_str, "yes")==0);
return 1;
}
--- 2244,2250 -----
/* returns '1' if successful. result in def_str */
if (def_str = XGetDefault(theDisp, PROGNAME, name)) {
! def_int = rd_boolean(def_str);
return 1;
}
**************
*** 2234,2239
else return 0;
}
--- 2251,2335 -----
else return 0;
}
+ void XvFreeColors(display, colormap, pixels, npixels, planes, nfcols)
+ Display * display;
+ Colormap colormap;
+ unsigned long * pixels;
+ int npixels;
+ unsigned long planes;
+ int nfcols;
+ {
+ int i;
+
+ XSetErrorHandler(XvErrorHandler); /* Handle X_FreeColors error messages */
+ for (i=0; i<nfcols; i++)
+ XFreeColors(display, colormap, &pixels[i], npixels, planes);
+ XSync(theDisp, False); /* Sync the display so that there won't be */
+ XSetErrorHandler(0); /* problems restoring the default error handler */
+ }
+
+ static int XvErrorHandler(display, err)
+ Display *display;
+ XErrorEvent *err;
+ {
+ /*
+ * What should be done here? Probably a check for request code 88
+ * And a call to the default error handle under all other errors
+ */
+ }
+
+ /***********************************/
+ static int rd_boolean(value)
+ char *value;
+ {
+ int i;
+ int match;
+
+ #define MAXKEYWORDLEN 4 /* the strlen() of largest element in keywords[] */
+
+ char tmp[MAXKEYWORDLEN + 1];
+ char *ptr;
+ static char *keywords[] = {
+ "1",
+ "on",
+ "yes",
+ "true",
+ (char *) 0
+ };
+
+ /* Will 'value' fit in 'tmp' */
+ if (strlen(value) > MAXKEYWORDLEN)
+ { /* Nope, must no be a valid value */
+ return 0;
+ }
+ else
+ { /* get a local copy of value */
+ (void) strncpy(tmp, value, MAXKEYWORDLEN + 1);
+ }
+
+ /* convert the local copy to lower case */
+ ptr = tmp;
+ while (*ptr != '\0')
+ {
+ *ptr = isupper(*ptr) ? tolower(*ptr) : *ptr;
+ ptr++;
+ }
+
+ /* search the array of keywords for a match */
+ i = 0;
+ match = 0;
+ while (keywords[i] != (char *) 0)
+ {
+ if (strcmp(tmp, keywords[i]) == 0)
+ {
+ match = 1;
+ }
+ i++;
+ }
+
+ return(match);
+ }
+
*** disk$vis:[xv.orig]xv.h
--- xv.h
**************
*** 30,35
#include <math.h>
#include <ctype.h>
#include <string.h>
extern int errno; /* this SHOULD be in errno.h */
extern char *sys_errlist[]; /* this SHOULD be in errno.h */
--- 30,38 -----
#include <math.h>
#include <ctype.h>
#include <string.h>
+ #ifdef VMS
+ #include <errno.h>
+ #else
extern int errno; /* this SHOULD be in errno.h */
extern char *sys_errlist[]; /* this SHOULD be in errno.h */
#endif
**************
*** 32,37
#include <string.h>
extern int errno; /* this SHOULD be in errno.h */
extern char *sys_errlist[]; /* this SHOULD be in errno.h */
#ifndef __convexc__ /* Convex doesn't have <memory.h> */
#include <memory.h> /* for 'memset()' prototype */
--- 35,41 -----
#else
extern int errno; /* this SHOULD be in errno.h */
extern char *sys_errlist[]; /* this SHOULD be in errno.h */
+ #endif
/* Convex and VMS doesn't have <memory.h> */
#if !(defined(__convexc__) || defined(VMS))
**************
*** 33,39
extern int errno; /* this SHOULD be in errno.h */
extern char *sys_errlist[]; /* this SHOULD be in errno.h */
! #ifndef __convexc__ /* Convex doesn't have <memory.h> */
#include <memory.h> /* for 'memset()' prototype */
#endif
--- 37,44 -----
extern char *sys_errlist[]; /* this SHOULD be in errno.h */
#endif
! /* Convex and VMS doesn't have <memory.h> */
! #if !(defined(__convexc__) || defined(VMS))
#include <memory.h> /* for 'memset()' prototype */
#endif
**************
*** 38,45
#endif
/* neither IBM AOS 4.3, Convex, nor BSD 4.3 on VAX have <malloc.h> */
! #if !defined(ibm032) && !defined(__convexc__) && \
! !(defined(vax) && !defined(ultrix))
#if defined(hp300) || defined(hp800)
#include <sys/malloc.h> /* it's in 'sys' on HPs*/
#else
--- 43,49 -----
#endif
/* neither IBM AOS 4.3, Convex, nor BSD 4.3 on VAX have <malloc.h> */
! #if !defined(ibm032) && !defined(__convexc__) && !(defined(vax) && !defined(ultrix))
#if defined(hp300) || defined(hp800)
#include <sys/malloc.h> /* it's in 'sys' on HPs*/
#else
**************
*** 52,57
#define memcpy(d,s,l) bcopy(s,d,l)
#endif
#include <X11/Xos.h>
#include <X11/Xlib.h>
--- 56,67 -----
#define memcpy(d,s,l) bcopy(s,d,l)
#endif
+ #ifdef VMS
+ #define bcopy(src,dst,len) memcpy(dst,src,len)
+ #define unlink remove
+ #define index(s,c) strchr(s,c)
+ #define rindex(s,c) strrchr(s,c)
+ #endif
#include <X11/Xos.h>
#include <X11/Xlib.h>
**************
*** 68,73
#ifndef sgi /* silicon graphics doesn't have timeb.h */
#include <sys/timeb.h>
#endif
#include <signal.h>
#if defined(sco) && !defined(NOTIMER)
#include <sys/itimer.h>
--- 78,84 -----
#ifndef sgi /* silicon graphics doesn't have timeb.h */
#include <sys/timeb.h>
#endif
+ #undef SIGCHLD
#include <signal.h>
#if defined(sco) && !defined(NOTIMER)
#include <sys/itimer.h>
**************
*** 78,83
#endif
#ifdef NEEDSDIR
#ifdef sco
#include <sys/ndir.h>
#define lstat stat
--- 89,95 -----
#endif
#ifdef NEEDSDIR
+ #ifndef HPUX
#ifdef sco
#include <sys/ndir.h>
#define lstat stat
**************
*** 86,91
#include <sys/dir.h>
#endif /* ATT */
#endif /* sco */
#include <sys/param.h>
#include <sys/stat.h>
#ifdef DIRENT
--- 98,105 -----
#include <sys/dir.h>
#endif /* ATT */
#endif /* sco */
+ #endif /* not HPUX */
+ #ifndef VMS
#include <sys/param.h>
#endif /* not VMS */
#include <sys/stat.h>
**************
*** 87,92
#endif /* ATT */
#endif /* sco */
#include <sys/param.h>
#include <sys/stat.h>
#ifdef DIRENT
#include <dirent.h>
--- 101,107 -----
#endif /* not HPUX */
#ifndef VMS
#include <sys/param.h>
+ #endif /* not VMS */
#include <sys/stat.h>
#ifdef DIRENT
#ifdef VMS
**************
*** 89,94
#include <sys/param.h>
#include <sys/stat.h>
#ifdef DIRENT
#include <dirent.h>
#endif
#endif
--- 104,113 -----
#endif /* not VMS */
#include <sys/stat.h>
#ifdef DIRENT
+ #ifdef VMS
+ #include <descrip.h>
+ #include "dirent.h"
+ #else
#include <dirent.h>
#endif /* VMS */
#endif /* DIRENT */
**************
*** 90,97
#include <sys/stat.h>
#ifdef DIRENT
#include <dirent.h>
! #endif
! #endif
#ifdef NEEDSVARARGS
#include <varargs.h>
--- 109,117 -----
#include "dirent.h"
#else
#include <dirent.h>
! #endif /* VMS */
! #endif /* DIRENT */
! #endif /* NEEDSDIR */
#ifdef NEEDSVARARGS
#include <varargs.h>
**************
*** 100,106
/* signal macros */
#ifdef SVR4
#define HOLD_SIG sighold(SIGALRM) /* block ALRM sig from occurring */
! #define RELEASE_SIG sigrelse(SIGALRM) /*
#define PAUSE_SIG sigpause(SIGALRM) /* sleep until ALRM signal */
#else
#define HOLD_SIG sigblock(sigmask(SIGALRM))
--- 120,126 -----
/* signal macros */
#ifdef SVR4
#define HOLD_SIG sighold(SIGALRM) /* block ALRM sig from occurring */
! #define RELEASE_SIG sigrelse(SIGALRM) /* */
#define PAUSE_SIG sigpause(SIGALRM) /* sleep until ALRM signal */
#else
#define HOLD_SIG sigblock(sigmask(SIGALRM))
**************
*** 119,124
#undef PAUSE_SIG
#define PAUSE_SIG /* */
#else
#define UNCOMPRESS "/usr/ucb/uncompress" /* for uncompressing .Z files */
#endif
--- 139,148 -----
#undef PAUSE_SIG
#define PAUSE_SIG /* */
#else
+ #ifdef VMS
+ #define MAXPATHLEN 500
+ #define UNCOMPRESS "decompress" /* for uncompressing .Z files */
+ #endif /* VMS */
#define UNCOMPRESS "/usr/ucb/uncompress" /* for uncompressing .Z files */
#endif /* i386 */
**************
*** 120,126
#define PAUSE_SIG /* */
#else
#define UNCOMPRESS "/usr/ucb/uncompress" /* for uncompressing .Z files */
! #endif
#define PROGNAME "xv" /* used in resource database */
--- 144,150 -----
#define UNCOMPRESS "decompress" /* for uncompressing .Z files */
#endif /* VMS */
#define UNCOMPRESS "/usr/ucb/uncompress" /* for uncompressing .Z files */
! #endif /* i386 */
#define PROGNAME "xv" /* used in resource database */
**************
*** 298,305
#define RANGE(a,b,c) { if (a<b) a=b; if (a>c) a=c; }
/* PTINRECT returns '1' if x,y is in rect (inclusive) */
! #define PTINRECT(x,y,rx,ry,rw,rh) \
! ((x)>=(rx) && (y)>=(ry) && (x)<=(rx)+(rw) && (y)<=(ry)+(rh))
/* MONO returns total intensity of r,g,b components */
#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/
--- 322,328 -----
#define RANGE(a,b,c) { if (a<b) a=b; if (a>c) a=c; }
/* PTINRECT returns '1' if x,y is in rect (inclusive) */
! #define PTINRECT(x,y,rx,ry,rw,rh) ((x)>=(rx) && (y)>=(ry) && (x)<=(rx)+(rw) && (y)<=(ry)+(rh))
/* MONO returns total intensity of r,g,b components */
#define MONO(rd,gn,bl) (((rd)*11 + (gn)*16 + (bl)*5) >> 5) /*.33R+ .5G+ .17B*/
**************
*** 350,355
WHERE unsigned long freecols[256]; /* list of pixel values to free */
WHERE int nfcols; /* number of colors to free */
WHERE unsigned long cols[256]; /* maps pic pixel values to X pixel vals */
WHERE int fc2pcol[256]; /* maps freecols into pic pixel values */
WHERE int numcols; /* # of desired colors in picture */
--- 373,381 -----
WHERE unsigned long freecols[256]; /* list of pixel values to free */
WHERE int nfcols; /* number of colors to free */
+ #ifdef VMS
+ WHERE unsigned long colors[256]; /* maps pic pixel values to X pixel vals */
+ #else
WHERE unsigned long cols[256]; /* maps pic pixel values to X pixel vals */
#endif
WHERE int fc2pcol[256]; /* maps freecols into pic pixel values */
**************
*** 351,356
WHERE unsigned long freecols[256]; /* list of pixel values to free */
WHERE int nfcols; /* number of colors to free */
WHERE unsigned long cols[256]; /* maps pic pixel values to X pixel vals */
WHERE int fc2pcol[256]; /* maps freecols into pic pixel values */
WHERE int numcols; /* # of desired colors in picture */
WHERE int ncols; /* max # of (different) colors to alloc */
--- 377,383 -----
WHERE unsigned long colors[256]; /* maps pic pixel values to X pixel vals */
#else
WHERE unsigned long cols[256]; /* maps pic pixel values to X pixel vals */
+ #endif
WHERE int fc2pcol[256]; /* maps freecols into pic pixel values */
WHERE int numcols; /* # of desired colors in picture */
WHERE int ncols; /* max # of (different) colors to alloc */
**************
*** 370,376
noqcheck, /* true if we should NOT do QuickCheck */
rwcolor, /* true if we should use R/W color cells */
rwthistime, /* true if we DID use R/W color cells */
- brokeFreeCols, /* true if server has broken XFreeColors */
fish, /* turn on annoying fish */
fishrunning; /* true if fish are in operation */
--- 397,402 -----
noqcheck, /* true if we should NOT do QuickCheck */
rwcolor, /* true if we should use R/W color cells */
rwthistime, /* true if we DID use R/W color cells */
fish, /* turn on annoying fish */
fishrunning; /* true if fish are in operation */
**************
*** 428,433
void WRotate(void);
void InvCropRect(void);
void MakeRootPic(void);
/*************************** XVMISC.C ***************************/
Window CreateWindow(char *, char *, unsigned int, unsigned int,
--- 454,460 -----
void WRotate(void);
void InvCropRect(void);
void MakeRootPic(void);
+ void XvFreeColors(Display*, Colormap, unsigned long*, int, unsigned long, int);
/*************************** XVMISC.C ***************************/
Window CreateWindow(char *, char *, unsigned int, unsigned int,
**************
*** 558,563
int LoadXBM(char *, int);
int WriteXBM(FILE *, byte *, int, int, char *);
--- 585,592 -----
int LoadXBM(char *, int);
int WriteXBM(FILE *, byte *, int, int, char *);
+ /**************************** XVJPEG.C ***************************/
+ int LoadJFIF(char *, int);
**************
*** 570,575
/****************************** XV.C ****************************/
void DrawWindow(), WCrop(), WUnCrop(), WResize(), WRotate(), InvCropRect();
void MakeRootPic();
/*************************** XVMISC.C ***************************/
Window CreateWindow();
--- 599,605 -----
/****************************** XV.C ****************************/
void DrawWindow(), WCrop(), WUnCrop(), WResize(), WRotate(), InvCropRect();
void MakeRootPic();
+ void XvFreeColors();
/*************************** XVMISC.C ***************************/
Window CreateWindow();
**************
*** 632,636
/**************************** XVXBM.C ***************************/
int LoadXBM(), WriteXBM();
#endif
--- 662,668 -----
/**************************** XVXBM.C ***************************/
int LoadXBM(), WriteXBM();
+ /**************************** XVJPEG.C ***************************/
+ int LoadJFIF();
#endif
*** disk$vis:[xv.orig]xv24to8.c
--- xv24to8.c
**************
*** 73,79
static int Quick24to8();
static int QuickCheck();
! static byte tbl1[256], /* tables used in F-S Dithering */
tbl3[256], /* contain i/16, 3i/16, 5i/16, 7i/16, */
tbl5[256], /* (i=0-255) respectively */
tbl7[256];
--- 73,79 -----
static int Quick24to8();
static int QuickCheck();
! static int tbl1[256], /* tables used in F-S Dithering */
tbl3[256], /* contain i/16, 3i/16, 5i/16, 7i/16, */
tbl5[256], /* (i=-128..127) respectively */
tbl7[256];
**************
*** 75,81
static byte tbl1[256], /* tables used in F-S Dithering */
tbl3[256], /* contain i/16, 3i/16, 5i/16, 7i/16, */
! tbl5[256], /* (i=0-255) respectively */
tbl7[256];
--- 75,81 -----
static int tbl1[256], /* tables used in F-S Dithering */
tbl3[256], /* contain i/16, 3i/16, 5i/16, 7i/16, */
! tbl5[256], /* (i=-128..127) respectively */
tbl7[256];
**************
*** 508,516
byte *rp,*gp,*bp;
/*******************************/
{
! *rp = ((ptr->rmin + ptr->rmax) << (COLOR_DEPTH - B_DEPTH)) / 2;
! *gp = ((ptr->gmin + ptr->gmax) << (COLOR_DEPTH - B_DEPTH)) / 2;
! *bp = ((ptr->bmin + ptr->bmax) << (COLOR_DEPTH - B_DEPTH)) / 2;
}
--- 508,517 -----
byte *rp,*gp,*bp;
/*******************************/
{
! /* +1 ensures that color represents the middle of the box */
! *rp = ((ptr->rmin + ptr->rmax + 1) << (COLOR_DEPTH - B_DEPTH)) / 2;
! *gp = ((ptr->gmin + ptr->gmax + 1) << (COLOR_DEPTH - B_DEPTH)) / 2;
! *bp = ((ptr->bmin + ptr->bmax + 1) << (COLOR_DEPTH - B_DEPTH)) / 2;
}
**************
*** 674,680
int *thisline, *nextline, *tmpptr;
int r1, g1, b1, r2, g2, b2;
int i, j, imax, jmax, oval;
! byte *inptr, *outptr, *tmpbptr;
int lastline, lastpixel;
imax = HIGH - 1;
--- 675,681 -----
int *thisline, *nextline, *tmpptr;
int r1, g1, b1, r2, g2, b2;
int i, j, imax, jmax, oval;
! byte *inptr, *outptr;
int lastline, lastpixel;
imax = HIGH - 1;
**************
*** 694,701
outptr = (byte *) pic;
/* get first line of picture */
! for (j=WIDE * 3, tmpptr=nextline, tmpbptr=inptr; j; j--)
! *tmpptr++ = (int) *tmpbptr++;
for (i=0; i<HIGH; i++) {
/* swap thisline and nextline */
--- 695,702 -----
outptr = (byte *) pic;
/* get first line of picture */
! for (j=WIDE * 3, tmpptr=nextline; j; j--)
! *tmpptr++ = (int) *inptr++;
for (i=0; i<HIGH; i++) {
/* swap thisline and nextline */
**************
*** 703,710
lastline = (i==imax);
/* read in next line */
! for (j=WIDE * 3, tmpptr=nextline; j; j--)
! *tmpptr++ = (int) *inptr++;
/* dither this line and put it into the output picture */
thisptr = thisline; nextptr = nextline;
--- 704,712 -----
lastline = (i==imax);
/* read in next line */
! if (!lastline)
! for (j=WIDE * 3, tmpptr=nextline; j; j--)
! *tmpptr++ = (int) *inptr++;
/* dither this line and put it into the output picture */
thisptr = thisline; nextptr = nextline;
**************
*** 752,758
*outptr++ = oval;
r1 -= r[oval]; g1 -= g[oval]; b1 -= b[oval];
- /* can't use tables because r1,g1,b1 go negative */
if (!lastpixel) {
thisptr[0] += (r1*7)/16;
--- 754,759 -----
*outptr++ = oval;
r1 -= r[oval]; g1 -= g[oval]; b1 -= b[oval];
r1 += 128; /* make positive for table indexing */
g1 += 128;
**************
*** 754,759
r1 -= r[oval]; g1 -= g[oval]; b1 -= b[oval];
/* can't use tables because r1,g1,b1 go negative */
if (!lastpixel) {
thisptr[0] += (r1*7)/16;
thisptr[1] += (g1*7)/16;
--- 755,764 -----
r1 -= r[oval]; g1 -= g[oval]; b1 -= b[oval];
+ r1 += 128; /* make positive for table indexing */
+ g1 += 128;
+ b1 += 128;
+
if (!lastpixel) {
thisptr[0] += tbl7[r1];
thisptr[1] += tbl7[g1];
**************
*** 755,763
/* can't use tables because r1,g1,b1 go negative */
if (!lastpixel) {
! thisptr[0] += (r1*7)/16;
! thisptr[1] += (g1*7)/16;
! thisptr[2] += (b1*7)/16;
}
if (!lastline) {
--- 760,768 -----
b1 += 128;
if (!lastpixel) {
! thisptr[0] += tbl7[r1];
! thisptr[1] += tbl7[g1];
! thisptr[2] += tbl7[b1];
}
if (!lastline) {
**************
*** 762,770
if (!lastline) {
if (j) {
! nextptr[-3] += (r1*3)/16;
! nextptr[-2] += (g1*3)/16;
! nextptr[-1] += (b1*3)/16;
}
nextptr[0] += (r1*5)/16;
--- 767,775 -----
if (!lastline) {
if (j) {
! nextptr[-3] += tbl3[r1];
! nextptr[-2] += tbl3[g1];
! nextptr[-1] += tbl3[b1];
}
nextptr[0] += tbl5[r1];
**************
*** 767,775
nextptr[-1] += (b1*3)/16;
}
! nextptr[0] += (r1*5)/16;
! nextptr[1] += (g1*5)/16;
! nextptr[2] += (b1*5)/16;
if (!lastpixel) {
nextptr[3] += r1/16;
--- 772,780 -----
nextptr[-1] += tbl3[b1];
}
! nextptr[0] += tbl5[r1];
! nextptr[1] += tbl5[g1];
! nextptr[2] += tbl5[b1];
if (!lastpixel) {
nextptr[3] += tbl1[r1];
**************
*** 772,780
nextptr[2] += (b1*5)/16;
if (!lastpixel) {
! nextptr[3] += r1/16;
! nextptr[4] += g1/16;
! nextptr[5] += b1/16;
}
nextptr += 3;
}
--- 777,785 -----
nextptr[2] += tbl5[b1];
if (!lastpixel) {
! nextptr[3] += tbl1[r1];
! nextptr[4] += tbl1[g1];
! nextptr[5] += tbl1[b1];
}
nextptr += 3;
}
**************
*** 807,813
byte *pp;
int r1, g1, b1;
int *thisline, *nextline, *thisptr, *nextptr, *tmpptr;
! int i, j, rerr, gerr, berr, pwide3;
int imax, jmax;
pp = pic; pwide3 = w * 3; imax = h-1; jmax = w-1;
--- 812,818 -----
byte *pp;
int r1, g1, b1;
int *thisline, *nextline, *thisptr, *nextptr, *tmpptr;
! int i, j, val, pwide3;
int imax, jmax;
pp = pic; pwide3 = w * 3; imax = h-1; jmax = w-1;
**************
*** 812,818
pp = pic; pwide3 = w * 3; imax = h-1; jmax = w-1;
! /* load up colormap, 3 bits R, 3 bits G, 2 bits B (RRRGGGBB) */
for (i=0; i<256; i++) {
r[i] = ((i&0xe0) * 255) / 0xe0;
g[i] = ((i&0x1c) * 255) / 0x1c;
--- 817,833 -----
pp = pic; pwide3 = w * 3; imax = h-1; jmax = w-1;
! /* up to 256 colors: 3 bits R, 3 bits G, 2 bits B (RRRGGGBB) */
! #define RMASK 0xe0
! #define RSHIFT 0
! #define GMASK 0xe0
! #define GSHIFT 3
! #define BMASK 0xc0
! #define BSHIFT 6
!
! /* load up colormap */
! /* note that 0 and 255 of each color are always in the map; */
! /* intermediate values are evenly spaced. */
for (i=0; i<256; i++) {
r[i] = (((i<<RSHIFT) & RMASK) * 255 + RMASK/2) / RMASK;
g[i] = (((i<<GSHIFT) & GMASK) * 255 + GMASK/2) / GMASK;
**************
*** 814,822
/* load up colormap, 3 bits R, 3 bits G, 2 bits B (RRRGGGBB) */
for (i=0; i<256; i++) {
! r[i] = ((i&0xe0) * 255) / 0xe0;
! g[i] = ((i&0x1c) * 255) / 0x1c;
! b[i] = ((i&0x03) * 255) / 0x03;
}
thisline = (int *) malloc(pwide3 * sizeof(int));
--- 829,837 -----
/* note that 0 and 255 of each color are always in the map; */
/* intermediate values are evenly spaced. */
for (i=0; i<256; i++) {
! r[i] = (((i<<RSHIFT) & RMASK) * 255 + RMASK/2) / RMASK;
! g[i] = (((i<<GSHIFT) & GMASK) * 255 + GMASK/2) / GMASK;
! b[i] = (((i<<BSHIFT) & BMASK) * 255 + BMASK/2) / BMASK;
}
thisline = (int *) malloc(pwide3 * sizeof(int));
**************
*** 840,847
r1 = *thisptr++; g1 = *thisptr++; b1 = *thisptr++;
RANGE(r1,0,255); RANGE(g1,0,255); RANGE(b1,0,255);
! rerr = r1 & 0x1f; gerr = g1 & 0x1f; berr = b1 & 0x3f;
! *pp = (r1&0xe0) | ((g1>>3)&0x1c) | (b1>>6);
if (j!=jmax) { /* adjust RIGHT pixel */
thisptr[0] += tbl7[rerr];
--- 855,863 -----
r1 = *thisptr++; g1 = *thisptr++; b1 = *thisptr++;
RANGE(r1,0,255); RANGE(g1,0,255); RANGE(b1,0,255);
! /* choose actual pixel value */
! val = ((r1&RMASK)>>RSHIFT) | ((g1&GMASK)>>GSHIFT) | ((b1&BMASK)>>BSHIFT);
! *pp = val;
/* compute color errors */
r1 -= r[val];
**************
*** 843,848
rerr = r1 & 0x1f; gerr = g1 & 0x1f; berr = b1 & 0x3f;
*pp = (r1&0xe0) | ((g1>>3)&0x1c) | (b1>>6);
if (j!=jmax) { /* adjust RIGHT pixel */
thisptr[0] += tbl7[rerr];
thisptr[1] += tbl7[gerr];
--- 859,874 -----
val = ((r1&RMASK)>>RSHIFT) | ((g1&GMASK)>>GSHIFT) | ((b1&BMASK)>>BSHIFT);
*pp = val;
+ /* compute color errors */
+ r1 -= r[val];
+ g1 -= g[val];
+ b1 -= b[val];
+
+ /* Add fractions of errors to adjacent pixels */
+ r1 += 128; /* make positive for table indexing */
+ g1 += 128;
+ b1 += 128;
+
if (j!=jmax) { /* adjust RIGHT pixel */
thisptr[0] += tbl7[r1];
thisptr[1] += tbl7[g1];
**************
*** 844,852
*pp = (r1&0xe0) | ((g1>>3)&0x1c) | (b1>>6);
if (j!=jmax) { /* adjust RIGHT pixel */
! thisptr[0] += tbl7[rerr];
! thisptr[1] += tbl7[gerr];
! thisptr[2] += tbl7[berr];
}
if (i!=imax) { /* do BOTTOM pixel */
--- 870,878 -----
b1 += 128;
if (j!=jmax) { /* adjust RIGHT pixel */
! thisptr[0] += tbl7[r1];
! thisptr[1] += tbl7[g1];
! thisptr[2] += tbl7[b1];
}
if (i!=imax) { /* do BOTTOM pixel */
**************
*** 850,858
}
if (i!=imax) { /* do BOTTOM pixel */
! nextptr[0] += tbl5[rerr];
! nextptr[1] += tbl5[gerr];
! nextptr[2] += tbl5[berr];
if (j>0) { /* do BOTTOM LEFT pixel */
nextptr[-3] += tbl3[rerr];
--- 876,884 -----
}
if (i!=imax) { /* do BOTTOM pixel */
! nextptr[0] += tbl5[r1];
! nextptr[1] += tbl5[g1];
! nextptr[2] += tbl5[b1];
if (j>0) { /* do BOTTOM LEFT pixel */
nextptr[-3] += tbl3[r1];
**************
*** 855,863
nextptr[2] += tbl5[berr];
if (j>0) { /* do BOTTOM LEFT pixel */
! nextptr[-3] += tbl3[rerr];
! nextptr[-2] += tbl3[gerr];
! nextptr[-1] += tbl3[berr];
}
if (j!=jmax) { /* do BOTTOM RIGHT pixel */
--- 881,889 -----
nextptr[2] += tbl5[b1];
if (j>0) { /* do BOTTOM LEFT pixel */
! nextptr[-3] += tbl3[r1];
! nextptr[-2] += tbl3[g1];
! nextptr[-1] += tbl3[b1];
}
if (j!=jmax) { /* do BOTTOM RIGHT pixel */
**************
*** 861,869
}
if (j!=jmax) { /* do BOTTOM RIGHT pixel */
! nextptr[3] += tbl1[rerr];
! nextptr[4] += tbl1[gerr];
! nextptr[5] += tbl1[berr];
}
nextptr += 3;
}
--- 887,895 -----
}
if (j!=jmax) { /* do BOTTOM RIGHT pixel */
! nextptr[3] += tbl1[r1];
! nextptr[4] += tbl1[g1];
! nextptr[5] += tbl1[b1];
}
nextptr += 3;
}
**************
*** 880,890
/****************************/
{
int i;
! for (i=0; i<256; i++) { /* initialize Floyd-Steinberg division tables */
! tbl1[i] = i/16;
! tbl3[i] = (3*i)/16;
! tbl5[i] = (5*i)/16;
! tbl7[i] = (7*i)/16;
}
}
--- 906,926 -----
/****************************/
{
int i;
!
! /* initialize Floyd-Steinberg division tables */
! /* make sure rounding is done correctly for negative values! */
!
! for (i = -128; i < 0; i++) {
! tbl1[i+128] = -((8 -i )/16);
! tbl3[i+128] = -((8 -3*i)/16);
! tbl5[i+128] = -((8 -5*i)/16);
! tbl7[i+128] = -((8 -7*i)/16);
! }
! for (i = 0; i < 128; i++) {
! tbl1[i+128] = (i +8)/16;
! tbl3[i+128] = (3*i+8)/16;
! tbl5[i+128] = (5*i+8)/16;
! tbl7[i+128] = (7*i+8)/16;
}
}
*** disk$vis:[xv.orig]xvdir.c
--- xvdir.c
**************
*** 336,342
numdirnames = 0;
! #ifdef SYSV
getcwd(path, sizeof(path));
#else
getwd(path);
--- 336,342 -----
numdirnames = 0;
! #if (defined(SYSV) || defined(SVR4) || defined(VMS))
getcwd(path, sizeof(path));
#else
getwd(path);
**************
*** 385,391
/* figure out what type of file the beastie is */
dirnames[i][0] = C_REG; /* default to normal file, if lstat fails */
! #if defined(i386) || defined (SYSV)
if (stat(dirnames[i]+1, &st)==0) {
#else
if (lstat(dirnames[i]+1, &st)==0) {
--- 385,391 -----
/* figure out what type of file the beastie is */
dirnames[i][0] = C_REG; /* default to normal file, if lstat fails */
! #if defined(i386) || defined (SYSV) || defined (VMS)
if (stat(dirnames[i]+1, &st)==0) {
#else
if (lstat(dirnames[i]+1, &st)==0) {
**************
*** 425,431
RedrawDirW(0,0,DIRWIDE,DIRHIGH);
}
-
/***************************************************/
static int dnamcmp(s1,s2)
char **s1, **s2;
--- 425,430 -----
RedrawDirW(0,0,DIRWIDE,DIRHIGH);
}
/***************************************************/
static int dnamcmp(s1,s2)
char **s1, **s2;
**************
*** 539,544
/* open file */
fp = fopen(filename, "w");
if (!fp) {
SetISTR(ISTR_INFO,"Can't create '%s' - %s",filename,sys_errlist[errno]);
Warning();
if (bwpic) free(bwpic);
--- 538,546 -----
/* open file */
fp = fopen(filename, "w");
if (!fp) {
+ #ifdef VMS
+ SetISTR(ISTR_INFO,"Can't create '%s'",filename);
+ #else
SetISTR(ISTR_INFO,"Can't create '%s' - %s",filename,sys_errlist[errno]);
#endif
Warning();
**************
*** 540,545
fp = fopen(filename, "w");
if (!fp) {
SetISTR(ISTR_INFO,"Can't create '%s' - %s",filename,sys_errlist[errno]);
Warning();
if (bwpic) free(bwpic);
SetCursors(-1);
--- 542,548 -----
SetISTR(ISTR_INFO,"Can't create '%s'",filename);
#else
SetISTR(ISTR_INFO,"Can't create '%s' - %s",filename,sys_errlist[errno]);
+ #endif
Warning();
if (bwpic) free(bwpic);
SetCursors(-1);
*** disk$vis:[xv.orig]xvfish.c
--- xvfish.c
**************
*** 103,108
StopFish()
/**************/
{
struct itimerval it;
#ifdef POSIX
struct sigaction act;
--- 103,109 -----
StopFish()
/**************/
{
+ #ifndef VMS
struct itimerval it;
#endif
#ifdef POSIX
**************
*** 104,109
/**************/
{
struct itimerval it;
#ifdef POSIX
struct sigaction act;
#endif
--- 105,111 -----
{
#ifndef VMS
struct itimerval it;
+ #endif
#ifdef POSIX
struct sigaction act;
#endif
**************
*** 121,126
#endif
bzero(&it, sizeof(it));
it.it_interval.tv_usec = 0L;
it.it_value.tv_usec = 0L;
--- 123,129 -----
#endif
+ #ifndef VMS
bzero(&it, sizeof(it));
it.it_interval.tv_usec = 0L;
it.it_value.tv_usec = 0L;
**************
*** 135,140
RELEASE_SIG; /* allow ALRM signals to happen (we don't get them) */
fishrunning = 0;
#endif /* POSIX */
}
--- 138,144 -----
RELEASE_SIG; /* allow ALRM signals to happen (we don't get them) */
fishrunning = 0;
#endif /* POSIX */
+ #endif /* VMS */
}
**************
*** 177,182
static void setfishtimer()
/*******/
{
struct itimerval it;
#ifdef POSIX
struct sigaction act;
--- 181,187 -----
static void setfishtimer()
/*******/
{
+ #ifndef VMS
struct itimerval it;
#endif
#ifdef POSIX
**************
*** 178,183
/*******/
{
struct itimerval it;
#ifdef POSIX
struct sigaction act;
#endif
--- 183,189 -----
{
#ifndef VMS
struct itimerval it;
+ #endif
#ifdef POSIX
struct sigaction act;
#endif
**************
*** 181,186
#ifdef POSIX
struct sigaction act;
#endif
bzero(&it, sizeof(it));
it.it_value.tv_usec = DELAY;
--- 187,193 -----
#ifdef POSIX
struct sigaction act;
#endif
+ #ifndef VMS
bzero(&it, sizeof(it));
it.it_value.tv_usec = DELAY;
**************
*** 193,198
RELEASE_SIG; /* enable ALRM signals */
setitimer(ITIMER_REAL, &it, (struct itimerval *)0);
#endif /* POSIX */
}
--- 200,206 -----
RELEASE_SIG; /* enable ALRM signals */
setitimer(ITIMER_REAL, &it, (struct itimerval *)0);
#endif /* POSIX */
+ #endif /* VMS */
}
*** disk$vis:[xv.orig]xvgam.c
--- xvgam.c
**************
*** 620,640
LocalCmap = 0;
}
else {
! if (!brokeFreeCols) {
! for (i=0; i<nfcols; i++)
! XFreeColors(theDisp, theCmap, &freecols[i], 1, 0L);
! }
! else {
! for (i=0; i<nfcols; i++) {
! int j;
! for (j=0; j<i; j++) {
! if (freecols[i] == freecols[j]) /* already been freed once */
! break;
! }
! if (j==i) /* wasn't found in already-freed list */
! XFreeColors(theDisp, theCmap, &freecols[i], 1, 0L);
! }
! }
if (nfcols) {
XFlush(theDisp); /* just to make sure they're all freed right now... */
--- 620,626 -----
LocalCmap = 0;
}
else {
! XvFreeColors(theDisp, theCmap, freecols, 1, 0L, nfcols);
if (nfcols) {
XFlush(theDisp); /* just to make sure they're all freed right now... */
*** disk$vis:[xv.orig]xvgif.c
--- xvgif.c
**************
*** 88,94
/* An output array used by the decompressor */
int OutCode[1025];
! char *id = "GIF87a";
static int EGApalette[16][3] = {
{0,0,0}, {0,0,128}, {0,128,0}, {0,128,128},
--- 88,95 -----
/* An output array used by the decompressor */
int OutCode[1025];
! char *id87 = "GIF87a";
! char *id89 = "GIF89a";
static int EGApalette[16][3] = {
{0,0,0}, {0,0,128}, {0,128,0}, {0,128,128},
**************
*** 140,146
if (fread(ptr, filesize, 1, fp) != 1)
return( GifError("GIF data read failed") );
! if (strncmp(ptr, id, 6))
return( GifError("not a GIF file"));
ptr += 6;
--- 141,147 -----
if (fread(ptr, filesize, 1, fp) != 1)
return( GifError("GIF data read failed") );
! if (strncmp(ptr, id87, 6) && strncmp(ptr, id89, 6))
return( GifError("not a GIF file"));
ptr += 6;
*** disk$vis:[xv.orig]xvmisc.c
--- xvmisc.c
**************
*** 200,208
/************************************************/
typedef struct thing
! { byte r,g,b;
! int oldindex;
! int use; } CMAPENT;
static int CMAPcompare(a,b)
--- 200,210 -----
/************************************************/
typedef struct thing
! { byte r,g,b; /* actual value of color */
! int oldindex; /* its index in the old colormap */
! int use; /* # of pixels of this color */
! int mindist; /* min distance to a selected color */
! } CMAPENT;
/***********************************/
**************
*** 205,217
int use; } CMAPENT;
- static int CMAPcompare(a,b)
- CMAPENT *a,*b;
- {
- return (b->use - a->use);
- }
-
-
/***********************************/
void SortColormap()
{
--- 207,212 -----
} CMAPENT;
/***********************************/
void SortColormap()
{
**************
*** 216,223
void SortColormap()
{
byte *p;
! int i, j, k, mdist, entry, mn, d, hist[256], trans[256];
! static CMAPENT c[256], c1[256], *cp, *cj, *ck;
/* no point doing this if we're on a 1-bit display */
--- 211,218 -----
void SortColormap()
{
byte *p;
! int i, j, k, mdist, entry, d, hist[256], trans[256];
! CMAPENT c[256], c1[256], *cp, *cj, *ck;
/* no point doing this if we're on a 1-bit display */
**************
*** 243,248
cp = &c[numcols++];
cp->r = r[i]; cp->g = g[i]; cp->b = b[i];
cp->use = hist[i]; cp->oldindex = i;
}
}
--- 238,244 -----
cp = &c[numcols++];
cp->r = r[i]; cp->g = g[i]; cp->b = b[i];
cp->use = hist[i]; cp->oldindex = i;
+ cp->mindist = 100000;
}
}
**************
*** 256,273
c[entry].use = 0; /* and mark it dealt with */
! /* sort rest of colormap, in order of decreasing 'distance' from already
! allocated elements.
!
! FURTHER MODIFICATION of algorithm. The algorithm's performance
! utterly goes to hell as numcols increases. (Probably on the order
! of O^3 performance). Since I don't see a clever way of rewriting
! the algorithm for O^2 performance (which'd be acceptable), I'm going
! to make a trade-off. I'll only run the algorithm for the first 32 colors
! (or so). It can do that Real Fast. Then I'll just stick the rest of
! the unsorted colors (if any), and tack them on the end, in order of
! amount of use. This should give similar picture quality, with
! much higher performance. */
for (i=1; i<numcols && i<32; i++) {
/* find the i'th most different color */
--- 252,260 -----
c[entry].use = 0; /* and mark it dealt with */
! /* sort rest of colormap. Half of the entries are allocated on the
! basis of distance from already allocated colors, and half on the
! basis of usage. (NB: 'taxicab' distance is used throughout this file.)
To obtain O(n^2) performance, we keep each unselected color
(in c[], with use>0) marked with the minimum distance to any of
**************
*** 269,277
amount of use. This should give similar picture quality, with
much higher performance. */
! for (i=1; i<numcols && i<32; i++) {
! /* find the i'th most different color */
! entry = -1; mdist = -1;
for (j=0, cj=c; j<numcols; j++,cj++) {
if (cj->use) { /* this color has not been marked already */
mn = 10000;
--- 256,269 -----
basis of distance from already allocated colors, and half on the
basis of usage. (NB: 'taxicab' distance is used throughout this file.)
! To obtain O(n^2) performance, we keep each unselected color
! (in c[], with use>0) marked with the minimum distance to any of
! the selected colors (in c1[]). Each time we select a color, we
! can update the minimum distances in O(n) time. */
!
! for (i=1; i<numcols; i++) {
! /* First, update distances to the just-selected color */
! ck = &c1[i-1]; /* point to just-selected color */
for (j=0, cj=c; j<numcols; j++,cj++) {
if (cj->use) { /* can ignore already-selected colors */
d = abs(cj->r - ck->r) + abs(cj->g - ck->g) + abs(cj->b - ck->b);
**************
*** 273,281
/* find the i'th most different color */
entry = -1; mdist = -1;
for (j=0, cj=c; j<numcols; j++,cj++) {
! if (cj->use) { /* this color has not been marked already */
! mn = 10000;
! for (k=0, ck=c1; k<i; k++,ck++) {
d = abs(cj->r - ck->r) + abs(cj->g - ck->g) + abs(cj->b - ck->b);
if (mn>d) mn=d;
}
--- 265,271 -----
/* First, update distances to the just-selected color */
ck = &c1[i-1]; /* point to just-selected color */
for (j=0, cj=c; j<numcols; j++,cj++) {
! if (cj->use) { /* can ignore already-selected colors */
d = abs(cj->r - ck->r) + abs(cj->g - ck->g) + abs(cj->b - ck->b);
if (cj->mindist > d) cj->mindist = d;
}
**************
*** 277,283
mn = 10000;
for (k=0, ck=c1; k<i; k++,ck++) {
d = abs(cj->r - ck->r) + abs(cj->g - ck->g) + abs(cj->b - ck->b);
! if (mn>d) mn=d;
}
/* mn = minimum distance from c[j] to already used colors */
/* we want to select the unused color that has the greatest mn */
--- 267,273 -----
for (j=0, cj=c; j<numcols; j++,cj++) {
if (cj->use) { /* can ignore already-selected colors */
d = abs(cj->r - ck->r) + abs(cj->g - ck->g) + abs(cj->b - ck->b);
! if (cj->mindist > d) cj->mindist = d;
}
}
**************
*** 279,288
d = abs(cj->r - ck->r) + abs(cj->g - ck->g) + abs(cj->b - ck->b);
if (mn>d) mn=d;
}
- /* mn = minimum distance from c[j] to already used colors */
- /* we want to select the unused color that has the greatest mn */
- if (mn > mdist) { mdist = mn; entry = j; }
- }
}
/* c[entry] is the next color to put in the map. do so */
--- 269,274 -----
d = abs(cj->r - ck->r) + abs(cj->g - ck->g) + abs(cj->b - ck->b);
if (cj->mindist > d) cj->mindist = d;
}
}
if (i&1) {
**************
*** 284,289
if (mn > mdist) { mdist = mn; entry = j; }
}
}
/* c[entry] is the next color to put in the map. do so */
memcpy(&c1[i], &c[entry], sizeof(CMAPENT));
--- 270,295 -----
if (cj->mindist > d) cj->mindist = d;
}
}
+
+ if (i&1) {
+ /* Now find the i'th most different color */
+ /* we want to select the unused color that has the greatest mindist */
+ entry = -1; mdist = -1;
+ for (j=0, cj=c; j<numcols; j++,cj++) {
+ if (cj->use) { /* this color has not been marked already */
+ if (cj->mindist > mdist) { mdist = cj->mindist; entry = j; }
+ }
+ }
+ } else {
+ /* Now find the i'th most different color */
+ /* we want to select the unused color that has the greatest usage */
+ entry = -1; mdist = -1;
+ for (j=0, cj=c; j<numcols; j++,cj++) {
+ if (cj->use) { /* this color has not been marked already */
+ if (cj->use > mdist) { mdist = cj->use; entry = j; }
+ }
+ }
+ }
/* c[entry] is the next color to put in the map. do so */
memcpy(&c1[i], &c[entry], sizeof(CMAPENT));
**************
*** 290,300
c[entry].use = 0;
}
- /* tack rest of colors onto colormap in decreasing order of use */
- qsort((char *) c,numcols,sizeof(CMAPENT),CMAPcompare);
- memcpy(&c1[i], c, (numcols - i) * sizeof(CMAPENT));
-
-
/* build translation table */
for (i=0; i<numcols; i++) trans[ c1[i].oldindex ] = i;
--- 296,301 -----
c[entry].use = 0;
}
/* build translation table */
for (i=0; i<numcols; i++) trans[ c1[i].oldindex ] = i;
**************
*** 358,363
because when I say 'allocate me 32 colors' I want it to allocate
32 different colors, not 32 instances of the same 4 shades... */
for (i=0; i<numcols; i++) cols[i] = NOPIX;
cmap = theCmap;
--- 359,367 -----
because when I say 'allocate me 32 colors' I want it to allocate
32 different colors, not 32 instances of the same 4 shades... */
+ #ifdef VMS
+ for (i=0; i<numcols; i++) colors[i] = NOPIX;
+ #else
for (i=0; i<numcols; i++) cols[i] = NOPIX;
#endif
**************
*** 359,364
32 different colors, not 32 instances of the same 4 shades... */
for (i=0; i<numcols; i++) cols[i] = NOPIX;
cmap = theCmap;
for (i=0; i<numcols && unique<ncols; i++) {
--- 363,369 -----
for (i=0; i<numcols; i++) colors[i] = NOPIX;
#else
for (i=0; i<numcols; i++) cols[i] = NOPIX;
+ #endif
cmap = theCmap;
for (i=0; i<numcols && unique<ncols; i++) {
**************
*** 370,375
if (XAllocColor(theDisp, cmap, &defs[i])) {
unsigned long pixel, *fcptr;
pixel = cols[i] = defs[i].pixel;
/* see if the newly allocated color is new and different */
--- 375,383 -----
if (XAllocColor(theDisp, cmap, &defs[i])) {
unsigned long pixel, *fcptr;
+ #ifdef VMS
+ pixel = colors[i] = defs[i].pixel;
+ #else
pixel = cols[i] = defs[i].pixel;
#endif
**************
*** 371,376
unsigned long pixel, *fcptr;
pixel = cols[i] = defs[i].pixel;
/* see if the newly allocated color is new and different */
for (j=0, fcptr=freecols; j<nfcols && *fcptr!=pixel; j++,fcptr++);
--- 379,385 -----
pixel = colors[i] = defs[i].pixel;
#else
pixel = cols[i] = defs[i].pixel;
+ #endif
/* see if the newly allocated color is new and different */
for (j=0, fcptr=freecols; j<nfcols && *fcptr!=pixel; j++,fcptr++);
**************
*** 395,400
allocated our own colormap, and have STILL run out of colors
(possible, even on an 8 bit display), just mark pixel as
unallocated. We'll deal with it later */
cols[i] = NOPIX;
}
} /* FIRST PASS */
--- 404,412 -----
allocated our own colormap, and have STILL run out of colors
(possible, even on an 8 bit display), just mark pixel as
unallocated. We'll deal with it later */
+ #ifdef VMS
+ colors[i] = NOPIX;
+ #else
cols[i] = NOPIX;
#endif
}
**************
*** 396,401
(possible, even on an 8 bit display), just mark pixel as
unallocated. We'll deal with it later */
cols[i] = NOPIX;
}
} /* FIRST PASS */
--- 408,414 -----
colors[i] = NOPIX;
#else
cols[i] = NOPIX;
+ #endif
}
} /* FIRST PASS */
**************
*** 434,439
XQueryColors(theDisp, cmap, ctab, dc);
for (i=0; i<numcols && unique<ncols; i++)
if (cols[i]==NOPIX) { /* an unallocated pixel */
int d, mdist, close;
unsigned long ri,gi,bi;
--- 447,455 -----
XQueryColors(theDisp, cmap, ctab, dc);
for (i=0; i<numcols && unique<ncols; i++)
+ #ifdef VMS
+ if (colors[i]==NOPIX) { /* an unallocated pixel */
+ #else
if (cols[i]==NOPIX) { /* an unallocated pixel */
#endif
int d, mdist, close;
**************
*** 435,440
for (i=0; i<numcols && unique<ncols; i++)
if (cols[i]==NOPIX) { /* an unallocated pixel */
int d, mdist, close;
unsigned long ri,gi,bi;
--- 451,457 -----
if (colors[i]==NOPIX) { /* an unallocated pixel */
#else
if (cols[i]==NOPIX) { /* an unallocated pixel */
+ #endif
int d, mdist, close;
unsigned long ri,gi,bi;
**************
*** 451,456
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
if (XAllocColor(theDisp, cmap, &ctab[close])) {
memcpy(&defs[i], &ctab[close], sizeof(XColor));
cols[i] = ctab[close].pixel;
fc2pcol[nfcols] = i;
freecols[nfcols++] = cols[i];
--- 468,476 -----
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
if (XAllocColor(theDisp, cmap, &ctab[close])) {
memcpy(&defs[i], &ctab[close], sizeof(XColor));
+ #ifdef VMS
+ colors[i] = ctab[close].pixel;
+ #else
cols[i] = ctab[close].pixel;
#endif
fc2pcol[nfcols] = i;
**************
*** 452,457
if (XAllocColor(theDisp, cmap, &ctab[close])) {
memcpy(&defs[i], &ctab[close], sizeof(XColor));
cols[i] = ctab[close].pixel;
fc2pcol[nfcols] = i;
freecols[nfcols++] = cols[i];
p2alloc++;
--- 472,478 -----
colors[i] = ctab[close].pixel;
#else
cols[i] = ctab[close].pixel;
+ #endif
fc2pcol[nfcols] = i;
#ifdef VMS
freecols[nfcols++] = colors[i];
**************
*** 453,458
memcpy(&defs[i], &ctab[close], sizeof(XColor));
cols[i] = ctab[close].pixel;
fc2pcol[nfcols] = i;
freecols[nfcols++] = cols[i];
p2alloc++;
unique++;
--- 474,482 -----
cols[i] = ctab[close].pixel;
#endif
fc2pcol[nfcols] = i;
+ #ifdef VMS
+ freecols[nfcols++] = colors[i];
+ #else
freecols[nfcols++] = cols[i];
#endif
p2alloc++;
**************
*** 454,459
cols[i] = ctab[close].pixel;
fc2pcol[nfcols] = i;
freecols[nfcols++] = cols[i];
p2alloc++;
unique++;
}
--- 478,484 -----
freecols[nfcols++] = colors[i];
#else
freecols[nfcols++] = cols[i];
+ #endif
p2alloc++;
unique++;
}
**************
*** 467,472
(noglob), or B) the colors found in the X colormap */
for (i=0; i<numcols; i++) {
if (cols[i] == NOPIX) { /* an unallocated pixel */
int d, k, mdist, close;
unsigned long ri,gi,bi;
--- 492,500 -----
(noglob), or B) the colors found in the X colormap */
for (i=0; i<numcols; i++) {
+ #ifdef VMS
+ if (colors[i] == NOPIX) { /* an unallocated pixel */
+ #else
if (cols[i] == NOPIX) { /* an unallocated pixel */
#endif
int d, k, mdist, close;
**************
*** 468,473
for (i=0; i<numcols; i++) {
if (cols[i] == NOPIX) { /* an unallocated pixel */
int d, k, mdist, close;
unsigned long ri,gi,bi;
--- 496,502 -----
if (colors[i] == NOPIX) { /* an unallocated pixel */
#else
if (cols[i] == NOPIX) { /* an unallocated pixel */
+ #endif
int d, k, mdist, close;
unsigned long ri,gi,bi;
**************
*** 483,488
}
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
memcpy(&defs[i], &ctab[close], sizeof(XColor));
cols[i] = defs[i].pixel;
p3alloc++;
}
--- 512,520 -----
}
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
memcpy(&defs[i], &ctab[close], sizeof(XColor));
+ #ifdef VMS
+ colors[i] = defs[i].pixel;
+ #else
cols[i] = defs[i].pixel;
#endif
p3alloc++;
**************
*** 484,489
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
memcpy(&defs[i], &ctab[close], sizeof(XColor));
cols[i] = defs[i].pixel;
p3alloc++;
}
--- 516,522 -----
colors[i] = defs[i].pixel;
#else
cols[i] = defs[i].pixel;
+ #endif
p3alloc++;
}
**************
*** 497,502
}
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
memcpy(&defs[i], &defs[close], sizeof(XColor));
cols[i] = defs[i].pixel;
}
}
--- 530,538 -----
}
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
memcpy(&defs[i], &defs[close], sizeof(XColor));
+ #ifdef VMS
+ colors[i] = defs[i].pixel;
+ #else
cols[i] = defs[i].pixel;
#endif
}
**************
*** 498,503
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
memcpy(&defs[i], &defs[close], sizeof(XColor));
cols[i] = defs[i].pixel;
}
}
} /* THIRD PASS */
--- 534,540 -----
colors[i] = defs[i].pixel;
#else
cols[i] = defs[i].pixel;
+ #endif
}
}
} /* THIRD PASS */
**************
*** 538,543
cmap = theCmap;
for (i=0; i<numcols; i++) cols[i] = NOPIX;
for (i=0; i<numcols && i<ncols; i++) {
--- 575,583 -----
cmap = theCmap;
+ #ifdef VMS
+ for (i=0; i<numcols; i++) colors[i] = NOPIX;
+ #else
for (i=0; i<numcols; i++) cols[i] = NOPIX;
#endif
**************
*** 539,544
cmap = theCmap;
for (i=0; i<numcols; i++) cols[i] = NOPIX;
for (i=0; i<numcols && i<ncols; i++) {
unsigned long pmr[1], pix[1];
--- 579,585 -----
for (i=0; i<numcols; i++) colors[i] = NOPIX;
#else
for (i=0; i<numcols; i++) cols[i] = NOPIX;
+ #endif
for (i=0; i<numcols && i<ncols; i++) {
unsigned long pmr[1], pix[1];
**************
*** 543,548
for (i=0; i<numcols && i<ncols; i++) {
unsigned long pmr[1], pix[1];
if (XAllocColorCells(theDisp, cmap, False, pmr, 0, pix, 1)) {
defs[i].pixel = cols[i] = pix[0];
defs[i].red = r[i]<<8;
defs[i].green = g[i]<<8;
--- 584,592 -----
for (i=0; i<numcols && i<ncols; i++) {
unsigned long pmr[1], pix[1];
if (XAllocColorCells(theDisp, cmap, False, pmr, 0, pix, 1)) {
+ #ifdef VMS
+ defs[i].pixel = colors[i] = pix[0];
+ #else
defs[i].pixel = cols[i] = pix[0];
#endif
defs[i].red = r[i]<<8;
**************
*** 544,549
unsigned long pmr[1], pix[1];
if (XAllocColorCells(theDisp, cmap, False, pmr, 0, pix, 1)) {
defs[i].pixel = cols[i] = pix[0];
defs[i].red = r[i]<<8;
defs[i].green = g[i]<<8;
defs[i].blue = b[i]<<8;
--- 588,594 -----
defs[i].pixel = colors[i] = pix[0];
#else
defs[i].pixel = cols[i] = pix[0];
+ #endif
defs[i].red = r[i]<<8;
defs[i].green = g[i]<<8;
defs[i].blue = b[i]<<8;
**************
*** 561,566
i--; /* redo the allocation request */
}
else cols[i] = NOPIX;
}
} /* for (i=0; ... */
--- 606,614 -----
i--; /* redo the allocation request */
}
+ #ifdef VMS
+ else colors[i] = NOPIX;
+ #else
else cols[i] = NOPIX;
#endif
}
**************
*** 562,567
}
else cols[i] = NOPIX;
}
} /* for (i=0; ... */
--- 610,616 -----
else colors[i] = NOPIX;
#else
else cols[i] = NOPIX;
+ #endif
}
} /* for (i=0; ... */
**************
*** 585,590
SetISTR(ISTR_COLOR,"Got %d out of %d colors.", nfcols,numcols);
for (i=0; i<numcols; i++)
if (cols[i]==NOPIX) { /* an unallocated pixel */
int k, d, mdist, close;
unsigned long ri,gi,bi;
--- 634,642 -----
SetISTR(ISTR_COLOR,"Got %d out of %d colors.", nfcols,numcols);
for (i=0; i<numcols; i++)
+ #ifdef VMS
+ if (colors[i]==NOPIX) { /* an unallocated pixel */
+ #else
if (cols[i]==NOPIX) { /* an unallocated pixel */
#endif
int k, d, mdist, close;
**************
*** 586,591
for (i=0; i<numcols; i++)
if (cols[i]==NOPIX) { /* an unallocated pixel */
int k, d, mdist, close;
unsigned long ri,gi,bi;
--- 638,644 -----
if (colors[i]==NOPIX) { /* an unallocated pixel */
#else
if (cols[i]==NOPIX) { /* an unallocated pixel */
+ #endif
int k, d, mdist, close;
unsigned long ri,gi,bi;
**************
*** 600,605
}
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
cols[i] = defs[close].pixel;
}
}
--- 653,661 -----
}
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
+ #ifdef VMS
+ colors[i] = defs[close].pixel;
+ #else
cols[i] = defs[close].pixel;
#endif
}
**************
*** 601,606
if (close<0) FatalError("This Can't Happen! (How reassuring.)");
cols[i] = defs[close].pixel;
}
}
--- 657,663 -----
colors[i] = defs[close].pixel;
#else
cols[i] = defs[close].pixel;
+ #endif
}
}
**************
*** 1131,1136
else {
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++,ip++) {
if ((i&0x1ffff) == 0) WaitCursor();
*ip = (byte) cols[*pp];
}
}
--- 1188,1196 -----
else {
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++,ip++) {
if ((i&0x1ffff) == 0) WaitCursor();
+ #ifdef VMS
+ *ip = (byte) colors[*pp];
+ #else
*ip = (byte) cols[*pp];
#endif
}
**************
*** 1132,1137
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++,ip++) {
if ((i&0x1ffff) == 0) WaitCursor();
*ip = (byte) cols[*pp];
}
}
--- 1192,1198 -----
*ip = (byte) colors[*pp];
#else
*ip = (byte) cols[*pp];
+ #endif
}
}
**************
*** 1199,1204
for (i=0, pp=epic, lip=imagedata; i<eHIGH; i++, lip+=bperline) {
if ((i&127) == 0) WaitCursor();
for (j=0, ip=lip, half=0; j<eWIDE; j++,pp++,half++) {
if (half&1) { *ip = *ip + ((cols[*pp]&0x0f)<<4); ip++; }
else *ip = cols[*pp]&0x0f;
}
--- 1260,1269 -----
for (i=0, pp=epic, lip=imagedata; i<eHIGH; i++, lip+=bperline) {
if ((i&127) == 0) WaitCursor();
for (j=0, ip=lip, half=0; j<eWIDE; j++,pp++,half++) {
+ #ifdef VMS
+ if (half&1) { *ip = *ip + ((colors[*pp]&0x0f)<<4); ip++; }
+ else *ip = colors[*pp]&0x0f;
+ #else
if (half&1) { *ip = *ip + ((cols[*pp]&0x0f)<<4); ip++; }
else *ip = cols[*pp]&0x0f;
#endif
**************
*** 1201,1206
for (j=0, ip=lip, half=0; j<eWIDE; j++,pp++,half++) {
if (half&1) { *ip = *ip + ((cols[*pp]&0x0f)<<4); ip++; }
else *ip = cols[*pp]&0x0f;
}
}
}
--- 1266,1272 -----
#else
if (half&1) { *ip = *ip + ((cols[*pp]&0x0f)<<4); ip++; }
else *ip = cols[*pp]&0x0f;
+ #endif
}
}
}
**************
*** 1207,1212
else if (theImage->bits_per_pixel == 8) {
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++,ip++) {
if ((i&0x1ffff) == 0) WaitCursor();
*ip = (byte) cols[*pp];
}
}
--- 1273,1281 -----
else if (theImage->bits_per_pixel == 8) {
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++,ip++) {
if ((i&0x1ffff) == 0) WaitCursor();
+ #ifdef VMS
+ *ip = (byte) colors[*pp];
+ #else
*ip = (byte) cols[*pp];
#endif
}
**************
*** 1208,1213
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++,ip++) {
if ((i&0x1ffff) == 0) WaitCursor();
*ip = (byte) cols[*pp];
}
}
else FatalError("This display's too bizarre. Can't create XImage.");
--- 1277,1283 -----
*ip = (byte) colors[*pp];
#else
*ip = (byte) cols[*pp];
+ #endif
}
}
else FatalError("This display's too bizarre. Can't create XImage.");
**************
*** 1238,1243
else {
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++,ip++) {
if ((i&0x1ffff) == 0) WaitCursor();
*ip = (byte) cols[*pp];
}
}
--- 1308,1316 -----
else {
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++,ip++) {
if ((i&0x1ffff) == 0) WaitCursor();
+ #ifdef VMS
+ *ip = (byte) colors[*pp];
+ #else
*ip = (byte) cols[*pp];
#endif
}
**************
*** 1239,1244
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++,ip++) {
if ((i&0x1ffff) == 0) WaitCursor();
*ip = (byte) cols[*pp];
}
}
--- 1312,1318 -----
*ip = (byte) colors[*pp];
#else
*ip = (byte) cols[*pp];
+ #endif
}
}
**************
*** 1262,1267
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++) {
if ((i&0x1ffff) == 0) WaitCursor();
*ip++ = 0;
*ip++ = (cols[*pp]>>16) & 0xff;
*ip++ = (cols[*pp]>>8) & 0xff;
*ip++ = cols[*pp] & 0xff;
--- 1336,1346 -----
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++) {
if ((i&0x1ffff) == 0) WaitCursor();
*ip++ = 0;
+ #ifdef VMS
+ *ip++ = (colors[*pp]>>16) & 0xff;
+ *ip++ = (colors[*pp]>>8) & 0xff;
+ *ip++ = colors[*pp] & 0xff;
+ #else
*ip++ = (cols[*pp]>>16) & 0xff;
*ip++ = (cols[*pp]>>8) & 0xff;
*ip++ = cols[*pp] & 0xff;
**************
*** 1265,1270
*ip++ = (cols[*pp]>>16) & 0xff;
*ip++ = (cols[*pp]>>8) & 0xff;
*ip++ = cols[*pp] & 0xff;
}
else
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++) {
--- 1344,1350 -----
*ip++ = (cols[*pp]>>16) & 0xff;
*ip++ = (cols[*pp]>>8) & 0xff;
*ip++ = cols[*pp] & 0xff;
+ #endif
}
else
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++) {
**************
*** 1269,1274
else
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++) {
if ((i&0x1ffff) == 0) WaitCursor();
*ip++ = cols[*pp] & 0xff;
*ip++ = (cols[*pp]>>8) & 0xff;
*ip++ = (cols[*pp]>>16) & 0xff;
--- 1349,1359 -----
else
for (i=eWIDE*eHIGH, pp=epic, ip=imagedata; i>0; i--,pp++) {
if ((i&0x1ffff) == 0) WaitCursor();
+ #ifdef VMS
+ *ip++ = colors[*pp] & 0xff;
+ *ip++ = (colors[*pp]>>8) & 0xff;
+ *ip++ = (colors[*pp]>>16) & 0xff;
+ #else
*ip++ = cols[*pp] & 0xff;
*ip++ = (cols[*pp]>>8) & 0xff;
*ip++ = (cols[*pp]>>16) & 0xff;
**************
*** 1272,1277
*ip++ = cols[*pp] & 0xff;
*ip++ = (cols[*pp]>>8) & 0xff;
*ip++ = (cols[*pp]>>16) & 0xff;
*ip++ = 0;
}
}
--- 1357,1363 -----
*ip++ = cols[*pp] & 0xff;
*ip++ = (cols[*pp]>>8) & 0xff;
*ip++ = (cols[*pp]>>16) & 0xff;
+ #endif
*ip++ = 0;
}
}
**************
*** 1571,1576
/*******/
{
long usec;
struct itimerval it;
if (!n) return;
--- 1657,1663 -----
/*******/
{
long usec;
+ #ifndef VMS
struct itimerval it;
#endif
**************
*** 1572,1577
{
long usec;
struct itimerval it;
if (!n) return;
if (fishrunning) { PAUSE_SIG; return; }
--- 1659,1665 -----
long usec;
#ifndef VMS
struct itimerval it;
+ #endif
if (!n) return;
if (fishrunning) { PAUSE_SIG; return; }
**************
*** 1591,1596
return;
#endif
usec = (long) n * 1000;
memset(&it, 0, sizeof(it));
--- 1679,1685 -----
return;
#endif
+ #ifndef VMS
usec = (long) n * 1000;
memset(&it, 0, sizeof(it));
**************
*** 1611,1616
RELEASE_SIG; /* turn ALRM blocking off */
signal(SIGALRM,SIG_DFL);
}
--- 1700,1704 -----
RELEASE_SIG; /* turn ALRM blocking off */
signal(SIGALRM,SIG_DFL);
+ #endif /* VMS */
}
**************
*** 1612,1620
RELEASE_SIG; /* turn ALRM blocking off */
signal(SIGALRM,SIG_DFL);
}
-
-
-
-
-
-
--- 1702,1704 -----
signal(SIGALRM,SIG_DFL);
#endif /* VMS */
}